// never forget to include std.mi
#include "../../../lib/std.mi"


Global Group drawergroup;
Global Layout mainLayout;
Global Int drawerstatus;

System.onScriptLoaded() {
  mainLayout = getContainer("main").getLayout("normal");
  drawergroup = mainLayout.getObject("drawer");
  drawerstatus = 1;
}


// .. drawer management ..
// you could check x and y to define a single 'clickable' zone on your group
// or you could also use an external button to make the drawer slide in or out, etc.


// if our drawer is closed, make it slide
drawergroup.onLeftButtonUp(int x, int y) {
  if (drawerstatus == 1) {
      drawergroup.setTargetX(38);
      drawergroup.setTargetY(96);
      drawergroup.setTargetSpeed(0.75);
      drawergroup.gotoTarget();
      drawerstatus = 0;
  }
  else {
	if(y>200){
      drawergroup.setTargetX(38);
      drawergroup.setTargetY(12);
      drawergroup.setTargetSpeed(0.75);
      drawergroup.gotoTarget();
      drawerstatus = 1;
      }
  }
}